<div class="layui-card-header layui-card">
    <span class="layui-breadcrumb" lay-filter="breadcrumb">
        <a lay-href="">首页</a>
        <a><cite>代理商信息</cite></a>
    </span>
</div>
<div class="layui-fluid">
    <div class="layui-card">
        <div class="layui-tab layui-tab-brief">
            <ul class="layui-tab-title">
                <li class="layui-this">基本信息</li>
            </ul>
            <div class="layui-tab-content">
                <style>
                    .leftT {
                        text-align: left;
                    }
                    table tbody tr:nth-child(even){
                        background-color: #FBFBFB;
                    }
                </style>
                <table  class="layui-table" id="BasicView" style="text-align:center"></table>
                <!-- 模板 -->
                <script type="text/html" id="BasicInfo">
                    {{#  if(d.bankName == null){d.bankName = "";} }}
                    {{#  if(d.bankNetName == null){d.bankNetName = ""} }}
                    {{#  if(d.accountName == null){d.accountName = ""} }}
                    {{#  if(d.accountNo == null){d.accountNo = ""} }}
                    {{#  if(d.province == null){d.province = ""} }}
                    {{#  if(d.city == null){d.city = ""} }}
                    {{#  if(d.agentLevel == 2){d.agentLevel = "商户代理"} }}
                    {{#  if(d.agentLevel == 1){d.agentLevel = "总代理"} }}
                    <table>
                        <colgroup>
                            <col width="25%">
                            <col>
                            <col width="25%">
                            <col>
                            <col width="25%">
                            <col>
                        </colgroup>
                        <tbody>
                            <tr>
                                <td>代理商ID</td>
                                <td class="leftT">{{d.agentId == null ? "" : d.agentId}}</td>
                                <td>代理商名称</td>
                                <td class="leftT">{{d.agentName == null ? "" : d.agentName}}</td>
                            </tr>
                            <tr>
                                <td>用户登录名</td>
                                <td class="leftT">{{d.userName == null ? "" : d.userName}}</td>
                                <td>状态</td>
                                <td class="leftT">{{(d.status == -1)?"待审核":(d.status == 0)?"关闭":(d.status == 1)?"开启":"非法状态"}}</td>
                            </tr>
                            <tr>
                                <td>真实姓名</td>
                                <td class="leftT">{{d.realName == null ? "" : d.realName}}</td>
                                <td>身份证号</td>
                                <td class="leftT">{{d.idCard == null ? "" : d.idCard}}</td>
                            </tr>
                            <tr>
                                <td>手机号</td>
                                <td class="leftT">{{d.mobile == null ? "" : d.mobile}}</td>
                                <td>邮箱地址</td>
                                <td class="leftT">{{d.email == null ? "" : d.email}}</td>
                            </tr>
                            <tr>
                                <td>座机号</td>
                                <td class="leftT">{{d.tel == null ? "" : d.tel}}</td>
                                <td>QQ</td>
                                <td class="leftT">{{d.qq == null ? "" : d.qq}}</td>
                            </tr>
                            <tr>
                                <td>通讯地址</td>
                                <td class="leftT" colspan="3">{{d.address == null ? "" : d.address}}</td>
                            </tr>
                        </tbody>
                    </table>
                    <br/>
                    <table>
                        <colgroup>
                            <col width="25%">
                            <col>
                            <col width="25%">
                            <col>
                            <col width="25%">
                            <col>
                        </colgroup>
                        <tbody>
                        <tr>
                            <td>开户行名称</td>
                            <td class="leftT">{{d.bankName == null ? '' : d.bankName}}</td>
                            <td>开户网点名称</td>
                            <td class="leftT">{{d.bankNetName == null ? '' : d.bankNetName}}</td>
                        </tr>
                        <tr>
                            <td>开户所在省</td>
                            <td class="leftT">{{d.province == null ? '' : d.province}}</td>
                            <td>开户所在市</td>
                            <td class="leftT">{{d.city == null ? '' : d.city}}</td>
                        </tr>
                        <tr>
                            <td>账户名</td>
                            <td class="leftT">{{d.accountName == null ? '' : d.accountName}}</td>
                            <td>账户号</td>
                            <td class="leftT">{{d.accountNo == null ? '' : d.accountNo}}</td>
                        </tr>
                        <tr>
                            <td>每日提现开始时间</td>
                            <td class="leftT">{{d.drawDayStartTime}}</td>
                            <td>每日提现结束时间</td>
                            <td class="leftT">{{d.drawDayEndTime}}</td>
                        </tr>
                        <tr>
                            <td>单笔最大提现金额(元)</td>
                            <td class="leftT">{{d.maxDrawAmount/100}}</td>
                            <td>单笔最小提现金额(元)</td>
                            <td class="leftT">{{d.minDrawAmount/100}}</td>
                        </tr>
                        <tr>
                            <td>每日提现最大金额(元)</td>
                            <td class="leftT">{{d.drawMaxDayAmount/100}}</td>
                            <td>每日提现次数(非代付)</td>
                            <td class="leftT">{{d.dayDrawTimes}}</td>
                        </tr>
                        <tr>
                            <td>手续费</td>
                            <td class="leftT">{{(d.feeType == 1) ? d.feeRate : (d.feeType == 2) ? d.feeLevel/100 + "元/笔" : "" }}</td>
                            <td>线下充值费率(%)</td>
                            <td class="leftT">{{d.offRechargeRate}}</td>
                        </tr>
                        <tr>
                            <td>代理等级</td>
                            <td class="leftT">{{d.agentLevel}}</td>
                        </tr>
                        </tbody>
                    </table>
                </script>
            </div>
        </div>

        <div class="layui-tab layui-tab-brief">
            <ul class="layui-tab-title">
                <li class="layui-this">账户信息</li>
            </ul>
            <div class="layui-tab-content">
                <table id="AccountView" class="layui-table" style="text-align:center"></table>
                <!-- 模板 -->
                <script type="text/html" id="AccountInfo">
                    <table>
                        <colgroup>
                            <col width="25%">
                            <col>
                            <col width="25%">
                            <col>
                            <col width="25%">
                            <col>
                        </colgroup>
                        <tbody>
                            <tr>
                                <td>账户余额(元)</td>
                                <td class="leftT">{{d.balance/100}}</td>
                                <td>可结算金额(元)</td>
                                <td class="leftT">{{d.settAmount/100}}</td>
                            </tr>
                            <tr>
                                <td>不可用余额(元)</td>
                                <td class="leftT" colspan="3">{{d.unBalance/100}}</td>
                            </tr>
                        </tbody>
                    </table>
                </script>
            </div>
        </div>


    </div>
</div>



<script>
   layui.use(['table','laytpl','admin',], function(){
        var form = layui.form
            ,laytpl = layui.laytpl
            ,table = layui.table
            ,$ = layui.$
            ,admin = layui.admin
            ,element = layui.element;

        element.render('breadcrumb', 'breadcrumb');//渲染导航信息

        admin.req({
           type: 'get',
           url:  layui.setter.baseUrl + '/agent/get' //模拟基本信息接口,
           ,error: function(err){
               console.log(err)
           },
           success: function(res){
               if(res.code == 0){
                   var getTpl = BasicInfo.innerHTML
                           ,view = document.getElementById('BasicView');
                   laytpl(getTpl).render(res.data, function(html){
                       view.innerHTML = html;
                   });
                   table.render();

                   $('.privateKey').val(res.data.privateKey);
               }
           }
        })

        admin.req({
            type: 'get',
            url: layui.setter.baseUrl + '/account/get' //模拟账户信息接口,
            ,error: function(err){
                console.log(err);
            },
            success: function(res){
                if(res.code == 0){
                    var getTpl = AccountInfo.innerHTML
                    ,view = document.getElementById('AccountView');
                    laytpl(getTpl).render(res.data, function(html){
                        view.innerHTML = html;
                    });
                    table.render();
                }
            }
        })

    });

</script>